fix(sdk): wire FSStorageProvider rootDir in resolveSquadState, fix teamRoot='.' sentinel (#1555) - #1695
Conversation
…amRoot='.' sentinel Fixes #1555 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🛫 PR Readiness Check
PR Scope: 📦🔧 Mixed (product + infrastructure)
|
| Status | Check | Details |
|---|---|---|
| ❌ | Single commit | 2 commits — consider squashing before review |
| ✅ | Not in draft | Ready for review |
| ❌ | Branch up to date | dev is 2 commit(s) ahead — rebase recommended |
| ❌ | Copilot review | No Copilot review yet — it may still be processing |
| ✅ | Changeset present | Changeset file found |
| ✅ | Scope clean | No .squad/ or docs/proposals/ files |
| ✅ | No merge conflicts | No merge conflicts |
| ✅ | Copilot threads resolved | No Copilot review threads |
| ✅ | CI passing | All checks passing |
Files Changed (3 files, +61 −3)
| File | +/− |
|---|---|
.changeset/1555-fs-storage-rootdir.md |
+5 −0 |
packages/squad-sdk/src/resolution.ts |
+10 −2 |
test/state-backend.test.ts |
+46 −1 |
Total: +61 −3
This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.
🟡 Impact Analysis — PR #1695Risk tier: 🟡 MEDIUM 📊 Summary
🎯 Risk Factors
📦 Modules Affectedroot (1 file)
squad-sdk (1 file)
tests (1 file)
This report is generated automatically for every PR. See #733 for details. |
There was a problem hiding this comment.
Pull request overview
Fixes two related path-resolution defects in the Squad SDK’s state/tooling path so local-backend state writes are correctly confined under the resolved squad/team directory, including externalized projects using teamRoot: "." as a sentinel.
Changes:
- Wire
FSStorageProviderwithrootDir = paths.teamDirwhen resolving local state storage. - Treat
config.teamRoot === "."as local mode (not remote) during path resolution. - Add regression tests covering
teamRoot: ".", traversal guarding, and an end-to-endsquad_decidewrite viaToolRegistry.
Show a summary per file
| File | Description |
|---|---|
packages/squad-sdk/src/resolution.ts |
Fixes teamRoot: "." mode detection and sets FSStorageProvider rootDir for local backend storage. |
test/state-backend.test.ts |
Adds regression coverage ensuring teamDir is .squad/, traversal escapes are blocked, and squad_decide writes to .squad/decisions/inbox/. |
.changeset/1555-fs-storage-rootdir.md |
Patch changeset documenting the bugfix and its impact on MCP state tools. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Lite
|
👋 Friendly nudge — this PR has had no activity for 7 days. What needs attention:
If this PR is abandoned, please close it. If it's blocked on something external, leave a comment so the team knows. |
Maintainer re-submission of #1666
Supersedes: #1666 (do not merge #1666; it may be closed once this merges)
What
resolveSquadState()now constructs the local-backendFSStorageProviderwithrootDirset, andresolveSquadPaths()treatsconfig.teamRoot === '.'as local mode instead of remote mode.Why
Closes #1555
Two independent defects in the same path, both live on
dev, both hit bysquad_decide/squad_state_*(the MCP state tools wired up instate-mcp.ts):resolveSquadState()built the local backend's storage asnew FSStorageProvider()— norootDir.FSStorageProvider's traversal guard isif (!this.rootDir) return filePath;— an unsetrootDirmakes it a no-op.resolveSquadPaths()'s remote-mode check isif (config && config.teamRoot).squad externalizewritesteamRoot: '.'as its "no separate team root" marker — but'.'is truthy, so this resolvedteamDir = path.resolve(projectRoot, '.')= one directory above.squad/.How
resolution.tsresolveSquadState():new FSStorageProvider(paths.teamDir)resolution.tsresolveSquadPaths():if (config && config.teamRoot && config.teamRoot !== '.')Files changed
packages/squad-sdk/src/resolution.ts— product fix (2 lines changed)test/state-backend.test.ts— regression tests (+46 lines).changeset/1555-fs-storage-rootdir.md— patch changeset for@bradygaster/squad-sdkValidation (maintainer re-run on current dev base)
npx vitest run test/state-backend.test.ts→ 147/147 passed ✅cd packages/squad-sdk && npm run build→ clean ✅cd packages/squad-cli && npm run build→ clean ✅origin/dev: 3 files, 61 insertions, 3 deletions, no file deletions, single commit ✅Co-authored-by: Ömer Can Gümüş omercangumus3@gmail.com
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com